class Contabilita::CoordinateBancarieController < DefaultController
  require_role self.parent_name.underscore
  active_scaffold :coordinate_bancarie do |config|
    config.label = Application.controller_label(self)
    list.sorting = [:predefinito => 'DESC']
    #config.subform.layout = :vertical
    columns = [:predefinito, :iban, :banca, :descrizione]
    columns_ref = [:coordinate_bancarie_ref_type, :coordinate_bancarie_ref]
    config.columns = config.subform.columns = columns
    config.list.columns = columns_ref + columns
    config.actions.exclude :create
    config.columns[:banca].form_ui = :record_select
    config.columns[:banca].options[:params] = {:filter => 'banche'} 
    config.columns[:predefinito].form_ui = :checkbox
    [:banca, :descrizione].each { |i| config.columns[i].inplace_edit = :ajax }
    config.columns[:descrizione].options[:size] = 60
    config.columns[:coordinate_bancarie_ref_type].label = "Tipo"
    config.columns[:coordinate_bancarie_ref].label = "Riferimento"

    config.actions.add :field_search
    config.field_search.columns = [:coordinate_bancarie_ref_type] + columns
    [:iban, :descrizione].each { |i|
      config.columns[i].search_ui = :text
    }
  end
end
